package work3;

import java.util.Scanner;

public class Quetion1 {
	public static void main(String[] args) {

		System.out.print("请输入学生成绩：");
		Scanner input = new Scanner(System.in);
		float score = input.nextFloat();
		input.close();
		char garde;

		System.out.println("-------- 使用if...else --------");
		if (score >= 0 && score < 60) {
			garde = 'D';
			System.out.println("成绩等级为D");
		} else if (score >= 60 && score < 80) {
			garde = 'C';
			System.out.println("成绩等级为C");
		} else if (score >= 80 && score < 90) {
			garde = 'B';
			System.out.println("成绩等级为B");
		} else if (score >= 90 && score <= 100) {
			garde = 'A';
			System.out.println("成绩等级为A");
		} else {
			garde = 'N';
			System.out.println("输入成绩不正确！");
		}

		System.out.println("-------- 使用switch...case --------");
		switch (garde) {
			case 'A':
				System.out.println("成绩等级为A");
				break;
			case 'B':
				System.out.println("成绩等级为B");
				break;
			case 'C':
				System.out.println("成绩等级为C");
				break;
			case 'D':
				System.out.println("成绩等级为D");
				break;
			default:
				System.out.println("输入成绩不正确！");
				break;
		}

	}
}
